# Replication Instructions

## Manifest

There are four replication scripts ("computational-formal-model.R", "random-forest-analysis.R", "make_figure-1.R", and "make-figure-5.R") and three datasets ("judgments.RData", "assignments.RData", and "judges.RData"). The replication scripts produce three output files ("comparative_statics.RData", "model_data.RData", and "trained_model.RData") and six figures ("figure-1.pdf", "figure-2.pdf", "figure-3.pdf", "figure-4.pdf", "figure-5.pdf", "figure-6.pdf").

Scripts: 
- computational-formal-model.R
- random-forest-analysis.R
- make-figure-1.R
- make-figure-5.R

Datasets:
- judgments.RData
- assignments.RData
- judges.RData

Output files:
- comparative_statics.RData
- model_data.RData
- trained_model.RData

Figures:
- figure-1.pdf
- figure-2.pdf
- figure-3.pdf
- figure-4.pdf
- figure-5.pdf
- figure-6.pdf

## Scripts

The script "computational-formal-model.R" replicates the simulations to calculate the comparative statics for the computational formal model. There are no input files. The code takes several minutes to run. The script produces "comparative_statics.RData", which contains the simulation results. It also creates "figure-2.pdf", "figure-3.pdf", and "figure-4.pdf".

The script "random-forest-analysis.R" replicates the empirical analysis. The input files are "assignments.RData" and "judges.RData". The random forest model takes several minutes to train. The script creates "model_data.RData", which is the input for the random forest model. It then produces "trained_model.RData", which contains the trained random forest model. It also runs the counterfactual simulations based on the trained random forest model and creates "figure-6.pdf".

The script "make-figure-1.R" creates "figure-1.pdf". The input file is "judgments.RData." 

The script "make-figure-5.R" creates "figure-5.pdf". The input files are "assignments.RData" and "judges.RData."

## Datasets

The file "judgments.RData" contains data on CJEU judgments. There is one observation per judgment of the Court of Justice and the General Court from 1954 through 2018. The data includes the ECLI number for each judgment, the Court that published each judgment, the year and date of each judgment, the size of the panel that heard the case, and the name of the formation of the Court that heard the case.

The file "assignments.RData" contains data on the judges that participated in each infringement case from 1954 through 2018. There is one observation per judge per judgment. The data includes the the ECLI number for each judgment, the year and date of each judgment, the judges that participated in each case, the size of the panel that heard the case, and whether the Commission was successful. 

The file "judges.RData" contains data on the judges who have served on the Court of Justice. There is one observation per judge. The data includes the name of each judge, the member state that appointed each judge, the start and end year for each judge, the number of infringement cases that each judge has participated in, the Commission's win-rate by judge.
